package com.zb.javabean;

import jdk.nashorn.internal.objects.annotations.Property;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @Author: 张波
 * @Time: 2025/8/19 18:48
 */
@Data
@Component
@Scope("prototype")//学生改为多例模式
public class Student {
	@Value("1000")
	private int stuID;
	@Value("小明")
	private String stuName;
	@Value("1000")
	private String stuPhone;
	@Value("男")
	private String stuGander;

	public Student() {
		System.out.println("学生被加载");
	}
//	初始化方法
	@PostConstruct
	public void init(){
		System.out.println("学生活了");
	}
	//销毁方法
	@PreDestroy
	public void die(){
		System.out.println("学生死了");
	}
}
